<template>
  <view class="video-preview">
    <view class="video-container">
      <video 
        :src="videoSrc" 
        controls 
        class="video-player"
        :poster="teacherImage"
      ></video>
    </view>
    <view class="video-info">
      <view class="teacher-info">
        <image :src="teacherImage" class="teacher-image" mode="aspectFill"></image>
        <text class="teacher-name">{{ teacher }}</text>
      </view>
      <text class="video-title">{{ title }}</text>
    </view>
  </view>
</template>

<script>
export default {
  name: "VideoPreview",
  props: {
    videoSrc: {
      type: String,
      required: true,
    },
    teacherImage: {
      type: String,
      required: true,
    },
    title: {
      type: String,
      required: true,
    },
    teacher: {
      type: String,
      required: true,
    },
  },
};
</script>

<style scoped>
.video-preview {
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
}

.video-player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-info {
  padding: 12px;
  background-color: #fff;
}

.teacher-info {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.teacher-image {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
}

.teacher-name {
  font-size: 14px;
  color: #666;
}

.video-title {
  font-size: 16px;
  font-weight: bold;
  color: #333;
}
</style>